//
//  KABasic.swift
//  kano
//
//  Created by Frank on 2024/8/27.
//

import KakaJSON

//MARK: request Param
struct KAApplyRowElement: Convertible, Codable {
    //fieldId
    var fieldId: Int = 0
    //fieldCode
    var fieldCode: String = ""
    //meaning
    var meaning: String = ""
    
    //sortId
    var sortId: Int = 0
    //pageId
    var pageId: Int = 0
}
struct KAApplyPageElement: Convertible, Codable {
    //taskId
    var taskId: String = ""
    var elements : [KAApplyRowElement]?
    
    //pageId
    var pageId: String = ""
    //backendUrl
    var backendUrl: String = ""
    //pageName
    var pageName: String = ""
    //uploadUrl
    var uploadUrl: String = ""
    //pageSortId
    var pageSortId: String = ""
    //pageUrl
    var pageUrl: String = ""
}

struct KAApplyElement: Convertible, Codable {
    //pageElements 3个页面的信息
    var pageElements : [KAApplyPageElement]?
    //creditResult 数据回显用的信息
    var creditResult: String = ""
    
    //token
    var token: String = ""
    //redirectUrl
    var redirectUrl: String = ""
    
    //fkUserGid
    var fkUserGid: String = ""
    //活体识别次数
    var liveCreditFailNum: String = ""
    //是否灰度用户，进行活体识别
    var liveCreditUser: Bool = false
    //livenessId
    var livenessId: String = ""
}

struct KAApply: Convertible, Codable {
    //basicsAuth 审核中: 1  审核失败:-1  审核成功: 2
    var basicsAuth: Int = 0
    //refuseFlag 被拒绝: 1、3   审核中: 8、10
    var refuseFlag: String = ""
    //installRefuseFlag 大额被拒状态:1
    var installRefuseFlag: String = ""
    //creditElement 所有数据都在这个集合里
    var creditElement: KAApplyElement?
    //1是白名单
    var authorizedEntityList: String = ""
    //risk_auth_param //1表示有联系人页面，其他值或者为空表示跳过联系人页面
    var risk_auth_param: String = ""
    //isHuidus 暂时未用到
    var isHuidus: Int = 0
    var authPageTip: String = ""
}


//MARK: UI show data
struct KAApplyRowInfo: Convertible, Codable {
    //parentId
    var parentId: Int = 0
    //value
    var value: Int = 0
    //label
    var label: String = ""
    //report
    var report: String = ""
}

struct KAApplyMobile: Convertible, Codable {
    //name
    var name: String = ""
    //phone
    var phone: String = ""
}

//提交和回显联系人contact数据模型
struct KAContact: Convertible, Codable {
    //relation1
    var relation1: KAApplyRowInfo = KAApplyRowInfo()
    //phoneNo1
    var phoneNo1: KAApplyMobile = KAApplyMobile()

    //relation2
    var relation2: KAApplyRowInfo = KAApplyRowInfo()
    //phoneNo2
    var phoneNo2: KAApplyMobile = KAApplyMobile()

    //relation3
    var relation3: KAApplyRowInfo = KAApplyRowInfo(parentId: 0, value: 1158953, label: "Friend", report: "Friend")
//    var relation3: KAApplyRowInfo = KAApplyRowInfo()
    //phoneNo3
    var phoneNo3: KAApplyMobile = KAApplyMobile()
}
//提交和回显基本数据personinfo数据模型
struct KAPerson: Convertible, Codable {
    
    var whatsapp: String = ""
    var facebook: String = ""
    
    //alternateNum
    var alternateNum: String = ""
    //email
    var email: String = ""
    //companyTel
    var companyTel: String = ""
    //jobBeginTime
    var jobBeginTime: String = ""
    //homeAddressDetail
    var homeAddressDetail: String = ""
    //educationLevel
    var educationLevel: KAApplyRowInfo = KAApplyRowInfo()
    //jobStatus
    var jobStatus : KAApplyRowInfo = KAApplyRowInfo()
    //job
    var job : KAApplyRowInfo = KAApplyRowInfo()
    //monthSalary
    var monthSalary : KAApplyRowInfo = KAApplyRowInfo()
    //marriageStatus
    var marriageStatus : KAApplyRowInfo = KAApplyRowInfo()
    //residentialType
    var residentialType : KAApplyRowInfo = KAApplyRowInfo()
    //homeAddressState
    var homeAddressState : KAApplyRowInfo = KAApplyRowInfo()
    //homeAddressRegion
    var homeAddressRegion : KAApplyRowInfo = KAApplyRowInfo()
    //payDay
    var payDay : KAApplyRowInfo = KAApplyRowInfo()
}
//提交和回显基本数据idcard数据模型
struct KABasic: Convertible, Codable {
    //firstName
    var firstName: String = ""
    //middleName
    var middleName: String = ""
    //surName
    var surName: String = ""
    //birthday
    var birthday: String = ""
    //gender
    var gender: String = ""
    //bvnInputed
    var bvnInputed: String = ""
}

struct KAApplySubmit: Convertible, Codable {
    //idcard
    var idcard : KABasic?
    //personinfo
    var personinfo : KAPerson?
    //contact
    var contact : KAContact?
}
